﻿using System;
using System.Collections.Generic;
using System.Text;

namespace _018传值_输出_引用_数组_具名_可选参数_6___输出参数
{
    internal class Program
    {
        static void Main(string[] args)
        {
            double result = 10;
            string s1=Console.ReadLine();
            bool b=DoubleParser.TryParse(s1,out result);
            if (!b)
            {
                Console.WriteLine("请输入准确值");
                Console.WriteLine(result);
            }
            else {

                Console.WriteLine(result);
            }

        }
    }

    class DoubleParser
    {

        public static bool TryParse(string input, out double result)
        {
            try
            {
                result =double.Parse(input);
                return true;
            }
            catch 
            {
                result = 0;
                return false;
             
            }
        
        }
    }
}
